package cn.nexd.app.collector.util;

import android.app.ProgressDialog;
import android.content.Context;

import cn.nexd.app.collector.R;


/**
 * Created by xun on 2016/8/8.
 */
public class ProgressUtil {
    private static ProgressDialog progressDialog;

    public static ProgressDialog createProgressDialog(Context context) {
        progressDialog = new ProgressDialog(context);
        progressDialog.setMessage(context.getString(R.string.msg_loading));
        progressDialog.setCanceledOnTouchOutside(false);
        progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        return progressDialog;
    }

    public static void show(Context context, String title, String message, boolean cancle) {
        progressDialog = new ProgressDialog(context);
        progressDialog.setTitle(title);
        progressDialog.setMessage(message);
        progressDialog.setCancelable(cancle);
        progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progressDialog.show();
    }

    public static void dismiss() {
        progressDialog.dismiss();
    }


}
